import { BasicDrawer, useDrawerInner } from "@/components/Drawer";
import { BasicForm, FormSchema, useForm } from "@/components/Form";
import { useTranslation } from "react-i18next";
const index = (props: { register: Fn }) => {
	const { t } = useTranslation();
	const en_vi = "Hospitalization.surgerySchedule";
	const formSchema: FormSchema[] = [
		{
			label: t(`${en_vi}.patientId`),
			field: "PatientID", //患者ID
			component: "Input"
		},
		{
			label: t(`${en_vi}.fullName`),
			field: "FullName", //姓名
			component: "Input"
		},
		{
			label: t(`${en_vi}.age`),
			field: "Age", //年龄
			component: "Input"
		},
		{
			label: t(`${en_vi}.gender`),
			field: "Gender", //性别
			component: "Select"
		},
		{
			label: t(`${en_vi}.insuranceCardNumber`),
			field: "InsuranceCardNumber", //保险卡号
			component: "Input"
		},
		{
			label: t(`${en_vi}.address`),
			field: "Address", //地址
			component: "Input"
		},
		{
			label: t(`${en_vi}.department`),
			field: "Department", //科室
			component: "Select"
		},
		{
			label: t(`${en_vi}.operatingRoom`),
			field: "OperatingRoom", //手术室
			component: "Select"
		},
		{
			label: t(`${en_vi}.bed`),
			field: "Bed", //病床
			component: "Input"
		},
		{
			label: t(`${en_vi}.date`),
			field: "Date", //日期
			component: "Input"
		},
		{
			label: t(`${en_vi}.order`),
			field: "Order", //医嘱
			component: "Input"
		},
		{
			label: t(`${en_vi}.diagnosis`),
			field: "Diagnosis", //诊断
			component: "Input"
		},
		{
			label: t(`${en_vi}.type`),
			field: "Type", //类型
			component: "Select"
		},
		{
			label: t(`${en_vi}.method`),
			field: "Method", //方法
			component: "Input"
		},
		{
			label: t(`${en_vi}.anesthesiaMethod`),
			field: "AnesthesiaMethod", //麻醉方法
			component: "Input"
		},
		{
			label: t(`${en_vi}.surgeon`),
			field: "Surgeon", //主刀医生
			component: "Input"
		},
		{
			label: t(`${en_vi}.assistantSurgeon`),
			field: "AssistantSurgeon", //助手医生
			component: "Input"
		},
		{
			label: t(`${en_vi}.anesthesiologist`),
			field: "Anesthesiologist", //麻醉师
			component: "Input"
		},
		{
			label: t(`${en_vi}.bloodType`),
			field: "BloodType", //血型
			component: "Select"
		},
		{
			label: t(`${en_vi}.bag`),
			field: "Bag", //袋子
			component: "Input"
		},
		{
			label: t(`${en_vi}.unit`),
			field: "Unit", //单位
			component: "Input"
		},
		{
			label: t(`${en_vi}.notes`),
			field: "Notes", //备注
			component: "Input"
		},
		{
			label: t(`${en_vi}.desiredDateTimeFromSurgeon`),
			field: "DesiredDate ", //主刀医生期望的日期和时间
			component: "DatePicker"
		},
		{
			label: t(`${en_vi}.estimatedDuration`),
			field: "EstimatedDuration ", //预计持续时间
			component: "Input"
		},
		{
			label: t(`${en_vi}.packageName`),
			field: "PackageName ", //包名
			component: "Input"
		}
	];

	const [registerDrawer, { closeDrawer }] = useDrawerInner(props.register, data => {
		console.log(data);
	});

	const [register, { validateFields }] = useForm({
		schemas: formSchema,
		labelWidth: 180,
		baseColProps: {
			span: 24
		}
	});
	const handleSubmit = async () => {
		const formValue = await validateFields();
		console.log(formValue);
		return;
		closeDrawer();
	};
	return (
		<BasicDrawer showFooter={true} {...props} register={registerDrawer} ok={handleSubmit}>
			<BasicForm register={register}></BasicForm>
		</BasicDrawer>
	);
};
export default index;
